//
//  DeinitViewController.swift
//  SwiftTest
//
//  Created by midea on 16/3/17.
//  Copyright © 2016年 Vincent. All rights reserved.
//

import Foundation

private class Animal {
    var name : String
    init(){
        name = "dog"
    }
    
    deinit{
        print("superClass's deinit working " + String(describing: self))
    }
}

private class Cat: Animal {
    override init(){
        super.init()
    }
    deinit{
        print("subClass's deinit working " + String(describing: self))
    }
}

class DeinitViewController : BaseViewController {
    
    fileprivate var name : String = "Michael"
    fileprivate var cat : Cat?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        cat = Cat.init()
    }
    
    deinit{
        print("deinit is working")
        print(name)
    }
}
